﻿using CodeGenerator.BaseUI;
using CodeGenerator.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Windows.Forms;

namespace CodeGenerator.UI
{
    public partial class FrmCenter : BaseForm
    {
        public FrmCenter()
        {
            InitializeComponent();
        }

        private void FrmCenter_Load(object sender, EventArgs e)
        {
            groupBox1.Visible = false;
            webBrowser1.Navigate("http://buildh.cn/log1.html");
            webBrowser1.ScriptErrorsSuppressed = true;
        }

        // 数据库字典生成
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            if (Constant.CurrentServerInfo != null && !string.IsNullOrEmpty(Constant.DatabaseName))
            {
                FrmDict frm = new FrmDict();
                frm.ShowDialog();
            }
            else
            {
                Common.MessageUtil.ShowWarning("请先选择一个数据库！！！");
            }
        }

        // 配置信息
        private void pictureBox3_Click(object sender, EventArgs e)
        {
            FrmSetup frm = new FrmSetup();
            frm.ShowDialog();
        }


        // BuildH代码批量生成
        private void pictureBox4_Click(object sender, EventArgs e)
        {
            if (Constant.CurrentServerInfo != null && !string.IsNullOrEmpty(Constant.DatabaseName))
            {
                FrmCreateBuildHMulti frm = new FrmCreateBuildHMulti();
                frm.ShowDialog();
            }
            else
            {
                Common.MessageUtil.ShowWarning("请先选择一个数据库！！！");
            }
        }

        // Mybatis代码批量生成
        private void pictureBox5_Click(object sender, EventArgs e)
        {

        }

        // 实体类属性批量生成
        private void pictureBox9_Click(object sender, EventArgs e)
        {
            if (Constant.CurrentServerInfo != null && !string.IsNullOrEmpty(Constant.DatabaseName))
            {
                FrmCreateEntityMulti frm = new FrmCreateEntityMulti();
                frm.ShowDialog();
            }
            else
            {
                Common.MessageUtil.ShowWarning("请先选择一个数据库！！！");
            }
        } 
    }
}
